/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved.
 */
package com.icinfo.cloud.provider.punish.ucase.payment.service.impl;

import com.icinfo.cloud.provider.common.exception.BusinessException;
import com.icinfo.cloud.provider.punish.ucase.payment.dto.CasePaymentItemDetailQueryDto;
import com.icinfo.cloud.provider.punish.ucase.payment.mapper.CasePaymentItemDetailMapper;
import com.icinfo.cloud.provider.punish.ucase.payment.model.CasePaymentItemDetail;
import com.icinfo.cloud.provider.punish.ucase.payment.service.ICasePaymentItemDetailService;
import com.icinfo.cloud.provider.punish.ucase.payment.vo.CasePaymentItemDetailVo;
import com.icinfo.cloud.provider.punish.ucase.payment.vo.CasePaymentMainRecordVo;
import com.icinfo.framework.core.service.support.MyBatisServiceSupport;
import com.icinfo.framework.mybatis.mapper.entity.Example;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

import javax.annotation.Resource;
import java.util.List;

/**
 * 描述:  case_payment_item_detail 对应的Service接口实现类.<br>
 *
 * @author framework generator
 * @date 2022年03月01日
 */
@Service
@Slf4j
public class CasePaymentItemDetailServiceImpl extends MyBatisServiceSupport implements ICasePaymentItemDetailService {

    @Resource
    private CasePaymentItemDetailMapper casePaymentItemDetailMapper;

    /**
     * 描述：查询缴款项目信息
     *
     * @param queryDto {@link CasePaymentItemDetailQueryDto}
     * @return {@link List <CasePaymentItemDetailVo>} 缴款项目信息
     * @author xiangyuyu
     * @date 2022-03-01 16:51
     */
    @Override
    public List<CasePaymentItemDetailVo> getCasePaymentItemDetailInfo(CasePaymentItemDetailQueryDto queryDto) {
        String paymentId = queryDto.getPaymentId();
        if (ObjectUtils.isEmpty(paymentId)) {
            throw new BusinessException("未指定支付编码");
        }
        List<CasePaymentItemDetailVo> casePaymentItemDetailList
                = casePaymentItemDetailMapper.selectCasePaymentItemDetailInfo(queryDto);
        return casePaymentItemDetailList;
    }
    /**
     * 描述：查询缴款信息明细
     * @param
     * @return {@link List <CasePaymentItemDetailVo>} 缴款项目信息
     * @author wangfawei
     * @date 2022-12-6
     */
    @Override
    public List<CasePaymentItemDetail> getCasePaymentItemDetailByPaymentId(String paymentId) {
        Example example = new Example(CasePaymentItemDetail.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("paymentId",paymentId);
        return casePaymentItemDetailMapper.selectByExample(example);
    }
    /**
     * 描述：查询缴款信息明细
     * @param
     * @return {@link List <CasePaymentItemDetailVo>} 缴款项目信息
     * @author wangfawei
     * @date 2022-12-6
     */
    @Override
    public int updateCasePaymentItemDetail(CasePaymentItemDetail casePaymentItemDetail) {
        return casePaymentItemDetailMapper.updateByPrimaryKeySelective(casePaymentItemDetail);
    }
}